<div class="linkStyle1">
	<a href="<?php echo site_url();?>/branch">Create New branch</a>
</div>
<?php echo form_open('branch/search', array('method' => 'get')); ?>
<div class="searchPanel">
	<input type="text" name="search" class="textboxSearch"
		value="<?php echo $search; ?>"
		placeholder="please enter the keyword" maxlength="30" /> <input
		type="submit" class="buttonSearch" value="search">
</div>
<?php echo form_close(); ?>
<div class="titleStyle1">Search Results</div>
<?php if (sizeof($result)> 0) {

	echo '<div class="serachResultTable ">';
	echo '<table id="resultTable">';
	echo '<tr>';
	echo '<td>Branch ID</td>';
	echo '<td>';
	echo 'Branch Name';
	echo '</td>';
	echo '<td>';
	echo 'Location';
	echo '</td>';
	echo '<td>';
	echo 'Tel';
	echo '</td>';
	echo '<td>';
	echo 'Setup Code';
	echo '</td>';
	echo '</tr>';

	foreach ($result as $branch){
		echo '<tr>';
		echo '<td>';
		echo $branch->branch_id;
		echo '</td>';
		echo '<td>';
		echo $branch->branch_name;
		echo '</td>';
		echo '<td>';
		echo $branch->branch_location;
		echo '</td>';
		echo '<td>';
		echo $branch->branch_tel;
		echo '</td>';
		echo '<td>';
		echo $branch->branch_code;
		echo '</td>';
		echo '</tr>';
	}

	echo '</table>';
	echo '</div>';
	echo $links;
}else{
	echo '<div class="information">';
	echo 'no result found.';
	echo '</div>';
}
?>

<script>
	$('#resultTable').find('tr').click( function(){
	  var item_id = $(this).find('td:first').text();
	  if (item_id > 0 )
	  	window.location.replace('<?php echo site_url()?>' + '/branch/update/' + item_id);
	});
</script>
